<?php

class m_tahunajar extends CI_Model {

    function __construct() {
        // Call the Model constructor
        parent::__construct();
    }

    // get detail tahun ajar
    function get_detail_data_tahunajar() {
        $sql = "SELECT * FROM tahun_ajaran";
        $query = $this->db->query($sql);
        if ($query->num_rows() > 0) {
            $result = $query->row_array();
            $query->free_result();
            return $result;
        } else {
            return array();
        }
    }

    // insert data ta
    function insert_data_tahunajar($params) {
        $sql = "INSERT INTO tahun_ajaran (semester, tahun) 
            VALUES(?, ?)";
        return $this->db->query($sql, $params);
    }

    // hapus data ta
    function delete_data_tahunajar() {
        $sql = "DELETE FROM tahun_ajaran";
        return $this->db->query($sql);
    }

}